#-*-coding:utf-8-*-
import os,shutil
from PIL import Image

# 对源文件夹下的图片批量提取，重设大小后，移到目标目录
def walkFolder(walkFolder, desfile):
    for folderName, subFolderNames, fileNames in os.walk(walkFolder):
        print("This is folder: " + folderName)
        for fileName in fileNames:
            print("filename is: " + folderName + "/" + fileName)
            image = Image.open(folderName + "/" + fileName)
            newImage = image.resize((120, 240))
            newImage.save(folderName + "/2" + fileName)
            shutil.move(folderName + "/2" + fileName, desfile+"/"+fileName)

if __name__ == '__main__':
    desfile = "/Users/zhangxiangbin/Desktop/print"
    walkFolder("/Users/zhangxiangbin/Downloads/二年级1班 - 5月29日班队活动", desfile)
